package com.lzy.cloud.goods.service.GoodsServiceImpl;

import com.lzy.cloud.goods.dtos.CarImageDto;
import com.lzy.cloud.goods.entity.CarImage;
import com.lzy.cloud.goods.mapper.CarImageMapperExt;
import com.lzy.cloud.goods.service.CarImageService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by WIN7 on 2018/6/9.
 */
@Service
public class CarImageServiceImpl implements CarImageService{

    @Autowired
    CarImageMapperExt carImageMapperExt;

    @Override
    public Boolean add(CarImageDto dto) {
        return carImageMapperExt.insertSelective(DozerUtils.map(dto, CarImage.class))>0;
    }

    @Override
    public Boolean delById(Long id) {
        return carImageMapperExt.deleteByPrimaryKey(id)>0;
    }

    @Override
    public Boolean delByKey(CarImageDto dto) {
        return carImageMapperExt.delByKey(dto)>0;
    }

    @Override
    public Boolean update(CarImageDto dto) {
        return carImageMapperExt.updateByPrimaryKeySelective(DozerUtils.map(dto,CarImage.class))>0;
    }

    @Override
    public List<CarImageDto> selectList(CarImageDto dto) {
        return carImageMapperExt.selectList(dto);
    }

    @Override
    public CarImageDto selectById(Long id) {
        return DozerUtils.map(carImageMapperExt.selectByPrimaryKey(id),CarImageDto.class);
    }

    @Override
    public Boolean delByKeyTrue(CarImageDto ciDto) {
        return carImageMapperExt.delByKeyTrue(ciDto)>0;
    }
}
